/* 移动端深蓝紫色系主题聊天应用 */
:root {
  --primary-bg: #1c1c2c;
  --secondary-bg: #232336;
  --panel-bg: #292942;
  --hover-bg: #32324d;
  --active-bg: #3a3a59;
  --sent-bubble-bg: #6366f1;
  --received-bubble-bg: #3a3a59;
  --text-primary: #ffffff;
  --text-secondary: #b4b4cc;
  --border-color: #3a3a59;
  --shadow-color: rgba(0, 0, 0, 0.4);
  --accent-color: #6366f1;
  --button-bg: #4f46e5;
  --button-text: #ffffff;
}

body {
  background-color: var(--primary-bg);
  color: var(--text-primary);
  margin: 0;
  padding: 0;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* 主容器 - 移动端全屏设计 */
.chat-app-container {
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  width: 100%;
  height: 100vh;
  margin: 0;
  box-shadow: none;
  border-radius: 0;
  overflow: hidden;
  background-color: var(--primary-bg);
}

/* 自定义滚动条样式 */
::-webkit-scrollbar {
  width: 3px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--accent-color);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #7e7bf6;
}

/* 左侧联系人列表 - 在移动端全屏显示 */
.chat-list-panel {
  width: 100%;
  background-color: var(--primary-bg);
  border-right: none;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: absolute;
  z-index: 10;
  left: 0;
  top: 0;
  transition: transform 0.3s ease;
}

.chat-list-panel.hidden {
  transform: translateX(-100%);
}

.chat-list-header {
  position: relative;
  padding: 15px;
  background-color: var(--panel-bg);
  border-bottom: 1px solid var(--border-color);
  font-weight: bold;
  color: var(--text-primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-list {
  flex-grow: 1;
  overflow-y: auto;
}

.chat-list-item {
  position: relative;
  display: flex;
  align-items: center;
  padding: 15px;
  cursor: pointer;
  border: none;
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.2s;
}

.chat-list-item:hover {
  background-color: var(--hover-bg);
}

.chat-list-item.active {
  background-color: var(--active-bg);
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  margin-right: 12px;
  background-color: var(--active-bg);
  object-fit: cover;
  flex-shrink: 0;
}

.user-info .user-name {
  font-weight: 500;
  color: var(--text-primary);
}

.delete-user-btn {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  font-size: 20px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0 5px;
  opacity: 0.6;
  transition: opacity 0.2s, color 0.2s;
}

.delete-user-btn:hover {
  opacity: 1;
  color: #ff4d4f;
}

/* 添加退出按钮样式 */
.logout-button {
  background-color: #7e3af2;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.logout-button:hover {
  background-color: #6c2bd9;
}

/* 返回按钮 */
.back-button {
  background-color: transparent;
  color: var(--text-primary);
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
}

.back-button svg {
  margin-right: 5px;
}

/* 右侧聊天窗口 */
.chat-window {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--primary-bg);
  height: 100%;
  z-index: 5;
}

.chat-window-placeholder {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  color: var(--text-secondary);
  font-size: 18px;
}

.chat-header {
  padding: 15px;
  border-bottom: 1px solid var(--border-color);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--panel-bg);
}

.chat-header .user-status {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.chat-header .header-actions {
  display: flex;
  align-items: center;
}

.chat-header .header-actions button {
  background: transparent;
  border: none;
  color: var(--text-primary);
  margin-left: 12px;
  cursor: pointer;
  padding: 8px;
  font-size: 20px;
}

/* 消息区域 */
.message-area {
  flex-grow: 1;
  padding: 15px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background-color: var(--primary-bg);
}

.message {
  display: flex;
  margin-bottom: 16px;
  max-width: 85%;
}

.message-content {
  display: flex;
  flex-direction: column;
}

.message-bubble {
  padding: 10px 14px;
  border-radius: 18px;
  word-wrap: break-word;
  line-height: 1.5;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* 收到的消息（左侧） */
.message.received {
  align-self: flex-start;
}

.message.received .message-bubble {
  background-color: var(--received-bubble-bg);
  border-top-left-radius: 4px;
  color: var(--text-primary);
}

/* 发送的消息（右侧） */
.message.sent {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message.sent .avatar {
  margin-left: 12px;
  margin-right: 0;
  display: none;
  /* 在移动端隐藏自己的头像 */
}

.message.sent .message-bubble {
  background-color: var(--sent-bubble-bg);
  color: white;
  border-top-right-radius: 4px;
}

/* 针对图片消息的气泡 */
.message-bubble.image-bubble {
  padding: 2px;
  background-color: transparent;
  border: 1px solid var(--border-color);
  overflow: hidden;
  max-width: 240px;
}

.message-bubble img {
  max-width: 100%;
  max-height: 240px;
  border-radius: 8px;
  display: block;
  cursor: pointer;
}

/* 时间戳 */
.message-timestamp {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
  text-align: right;
}

/* 消息输入区域 */
.message-input-area {
  position: relative;
  padding: 10px 15px;
  border-top: 1px solid var(--border-color);
  background-color: var(--secondary-bg);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* 图标行 */
.icon-row {
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

/* 输入行 */
.input-row {
  display: flex;
  align-items: center;
}

/* 工具栏按钮通用样式 */
.message-input-area button {
  background-color: var(--hover-bg);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 4px;
  cursor: pointer;
  transition: background-color 0.2s;
  color: var(--text-primary);
}

.message-input-area button:hover {
  background-color: var(--active-bg);
}

.message-input-area button:active {
  background-color: var(--accent-color);
}

.emoji-button,
.attach-button,
.video-button,
.flash-button {
  color: var(--text-primary);
  font-size: 20px;
}

.video-call-button {
  color: var(--text-primary);
  font-size: 20px;
}

.video-call-button.disabled {
  color: var(--text-secondary);
  cursor: not-allowed;
}

.device-checking {
  animation: blink 1s infinite;
}

@keyframes blink {
  0% {
    opacity: 0.2;
  }

  50% {
    opacity: 1;
  }

  100% {
    opacity: 0.2;
  }
}

.message-input {
  flex-grow: 1;
  border: none;
  background-color: var(--hover-bg);
  color: var(--text-primary);
  border-radius: 20px;
  padding: 10px 15px;
  margin: 0 8px;
  outline: none;
  height: 24px;
}

.message-input:focus {
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
}

.send-button {
  background-color: var(--button-bg);
  color: var(--button-text);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: background-color 0.2s;
}

.send-button:hover {
  background-color: #4338ca;
}

.no-contacts {
  padding: 20px;
  text-align: center;
  color: var(--text-secondary);
}

/* 登录界面 */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background-color: var(--primary-bg);
}

.login-box {
  background-color: var(--secondary-bg);
  border-radius: 12px;
  padding: 30px;
  width: 85%;
  max-width: 350px;
  text-align: center;
  box-shadow: 0 4px 12px var(--shadow-color);
}

.login-box h3 {
  color: var(--text-primary);
  margin-bottom: 24px;
  font-size: 22px;
  font-weight: 500;
}

.login-box input {
  width: 100%;
  padding: 14px;
  border: 1px solid var(--border-color);
  background-color: var(--hover-bg);
  color: var(--text-primary);
  border-radius: 8px;
  margin-bottom: 20px;
  box-sizing: border-box;
  font-size: 16px;
}

.login-box input:focus {
  border-color: var(--accent-color);
  outline: none;
}

.login-box button {
  background-color: var(--button-bg);
  color: var(--button-text);
  border: none;
  border-radius: 8px;
  padding: 14px 20px;
  width: 100%;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.login-box button:hover {
  background-color: #4338ca;
}

/* 表情选择器容器 */
.emoji-picker-container {
  position: absolute;
  bottom: 100px;
  left: 0;
  z-index: 100;
  border-radius: 12px;
  overflow: hidden;
  width: 100%;
  max-width: 320px;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.3);
}

/* 闪图相关样式 */
.flash-image-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 15px;
  background-color: var(--hover-bg);
  border-radius: 12px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.flash-image-placeholder:hover {
  background-color: var(--active-bg);
}

.flash-image-placeholder span:first-child {
  font-size: 24px;
  margin-bottom: 5px;
}

.flash-image-burned {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 15px;
  background-color: var(--hover-bg);
  border-radius: 12px;
  opacity: 0.7;
}

.flash-image-burned span:first-child {
  font-size: 24px;
  margin-bottom: 5px;
}

.flash-viewer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.95);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1100;
}

.flash-viewer-content {
  position: relative;
  max-width: 90%;
  max-height: 80%;
  display: flex;
  flex-direction: column;
}

.flash-viewer-content img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: 8px;
  object-fit: contain;
}

.flash-timer-bar {
  width: 100%;
  height: 4px;
  background-color: rgba(255, 255, 255, 0.2);
  margin-top: 10px;
  border-radius: 2px;
  overflow: hidden;
}

.flash-timer-progress {
  height: 100%;
  background-color: var(--accent-color);
  width: 100%;
  animation: flashTimer 5s linear forwards;
}

@keyframes flashTimer {
  from {
    width: 100%;
  }

  to {
    width: 0%;
  }
}

/* Lightbox 和闪图相关样式 - 深蓝紫色主题 */
.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(10, 10, 30, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  animation: fadeIn 0.3s;
}

.lightbox-content {
  position: relative;
  max-width: 90%;
  max-height: 85%;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 85vh;
  border-radius: 8px;
  display: block;
  object-fit: contain;
}

.lightbox-close-btn,
.lightbox-nav-btn {
  background: rgba(30, 30, 60, 0.7);
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  position: absolute;
  z-index: 10;
  transition: background-color 0.2s;
}

.lightbox-close-btn:hover,
.lightbox-nav-btn:hover {
  background: rgba(30, 30, 60, 0.9);
}

.lightbox-close-btn {
  top: 15px;
  right: 15px;
}

.lightbox-nav-btn {
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-nav-btn.prev {
  left: 15px;
}

.lightbox-nav-btn.next {
  right: 15px;
}

/* 视频消息样式 */
.video-message {
  width: 100%;
  display: flex;
  flex-direction: column;
}

.video-preview {
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  overflow: hidden;
  background-color: var(--hover-bg);
}

.video-thumbnail {
  width: 100%;
  max-height: 150px;
  object-fit: cover;
}

.video-placeholder {
  width: 100%;
  height: 120px;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: var(--panel-bg);
}

.video-icon {
  font-size: 32px;
}

.video-info {
  padding: 8px;
  display: flex;
  flex-direction: column;
}

.video-filename {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.video-filesize {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.video-link {
  padding: 8px;
  text-align: center;
  background-color: var(--button-bg);
  color: var(--button-text);
  text-decoration: none;
  border-radius: 0 0 8px 8px;
}

.inline-video {
  max-width: 100%;
  max-height: 240px;
  border-radius: 8px;
}

/* 媒体查询，适配不同移动设备 */
@media (max-width: 768px) {
  .message-input-area {
    padding: 8px;
  }

  .message-input-area button {
    width: 36px;
    height: 36px;
  }

  .message-input {
    padding: 8px 12px;
    height: 20px;
  }

  .chat-header {
    padding: 12px;
  }

  .message {
    max-width: 90%;
  }

  .message-bubble {
    padding: 8px 12px;
  }
}

/* 媒体查询 - 针对更小的手机屏幕 */
@media (max-width: 400px) {
  .chat-list-item {
    padding: 10px;
  }

  .avatar {
    width: 42px;
    height: 42px;
  }

  .message {
    max-width: 95%;
  }

  .login-box {
    width: 90%;
    padding: 20px;
  }
}

/* 视频通话相关样式 */
.video-call-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #000;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.remote-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1001;
}

.local-video {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 120px;
  height: 160px;
  object-fit: cover;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.8);
  z-index: 1002;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.call-status {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 12px 24px;
  border-radius: 24px;
  font-size: 18px;
  z-index: 1003;
}

/* 简化的控制条样式 */
.call-controls.simplified {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1004;
}

.call-controls.simplified .hang-up-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: #d32f2f;
  border: none;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 24px;
}

.call-controls.simplified .hang-up-btn:hover {
  background-color: #b71c1c;
  transform: scale(1.05);
}

.call-controls.simplified .hang-up-btn:active {
  transform: scale(0.95);
}

/* 连接状态指示器 */
.connection-status {
  position: absolute;
  top: 10px;
  left: 10px;
  background-color: rgba(0, 0, 0, 0.6);
  color: white;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 12px;
  z-index: 1004;
}

/* 来电通知样式 */
.incoming-call-modal {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: var(--secondary-bg);
  padding: 20px;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.4);
  z-index: 900;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: slideInUp 0.3s ease;
}

.incoming-call-content {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.caller-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  overflow: hidden;
  margin-bottom: 12px;
}

.caller-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.caller-info {
  text-align: center;
  margin-bottom: 20px;
}

.caller-name {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.call-type {
  font-size: 14px;
  color: var(--text-secondary);
}

.call-actions {
  display: flex;
  justify-content: center;
  gap: 40px;
  width: 100%;
}

.call-action-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  font-size: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.decline-btn {
  background-color: #d32f2f;
  color: white;
}

.decline-btn:hover {
  background-color: #b71c1c;
}

.accept-btn {
  background-color: #2e7d32;
  color: white;
}

.accept-btn:hover {
  background-color: #1b5e20;
}

/* 媒体查询 - 移动端适配 */
@media (max-width: 768px) {
  .local-video {
    width: 80px;
    height: 120px;
    top: 10px;
    right: 10px;
  }

  .call-controls.simplified .hang-up-btn {
    width: 56px;
    height: 56px;
  }

  .incoming-call-content {
    width: 280px;
    padding: 20px;
  }

  .caller-avatar {
    width: 80px;
    height: 80px;
  }

  .caller-name {
    font-size: 20px;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideInUp {
  from {
    transform: translateY(100%);
  }

  to {
    transform: translateY(0);
  }
}